﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AndreasJohansson.AutoMailic
{
  class Program
  {
    /// <summary>
    /// The application entry point.
    /// Do argument handling and start selected action
    /// </summary>
    /// <param name="args">Command line arguments</param>
    /// <example>
    /// To setup the event log
    ///   automailic /setup 
    ///   
    /// To start processing a section in an XML confiruation file
    ///   automailic config.xml section
    /// </example>
    static void Main(string[] args)
    {
      if (0 == args.Length || 0 == String.Compare(args[0], "//?", true))
      {
        Console.WriteLine("AutoMailic");
        Console.WriteLine("Copyright 2009 Andreas Johansson\n");
        Console.WriteLine("Usage:");
        Console.WriteLine("  automailic //setup");
        Console.WriteLine("  automailic configurationfile [section]\n");
        return;
      }
      else if (0 == String.Compare(args[0], "//setup", true))
      {
        return;
      }

      AutoMailer autoMailer = new AutoMailer();

      string sectionName = null;
      if (args.Length > 1)
      {
        sectionName = args[1];
      }

      autoMailer.Process(args[0], sectionName);
    }
  }
}
